// 类
function People(name, age) { // 类的首字母大写
  console.log(this); // this指向new出来的实例化对象
  this.name = name
  this.age = age
  People.count ++
  this.showName = function() {// 方法一般不会定义在构造函数内,应该定义在当前类的原型下面
    console.log('my name is ' + this.name);
  }
}

// 静态属性
People.count = 0
// 静态方法
People.getCount = function() {
  console.log('当前共有' + People.count + '个人');
}

let p1 = new People('yk', 25);
console.log(p1);

let p2 = new People('zhangsan', 20)
console.log(p2);